/*jadclipse*/// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.

package org.zty.db;

import com.ibatis.common.resources.Resources;
import com.ibatis.sqlmap.client.SqlMapClient;
import com.ibatis.sqlmap.client.SqlMapClientBuilder;
import java.io.Reader;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.Statement;
import java.sql.ResultSet;

public class DBMgr {

	public DBMgr() {
	}

	public static SqlMapClient getSqlMapClient() {
		return client;
	}

	/**
	 * 获取数据库连接
	 * @deprecated
	 * @return
	 */
	public static SqlMapClient getSqlMap() {
		return client;
	}

	private static final SqlMapClient client;

	static {
		try {
			Reader reader = Resources.getResourceAsReader("SqlMapConfig.xml");
			client = SqlMapClientBuilder.buildSqlMapClient(reader);
			reader.close();
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
	}
	
	public static void close(ResultSet rs,Statement stmt,Connection conn){
		try {
			if(rs!=null){
				rs.close();
			}
			rs = null;
		} catch (Exception e) {
		}
		try {
			if(stmt!=null){
				stmt.close();
			}
			stmt = null;
		} catch (Exception e) {
		}
		try {
			if(conn!=null){
				conn.close();
			}
			conn = null;
		} catch (Exception e) {
		}
	}
	public static void close(ResultSet rs,PreparedStatement pstmt,Connection conn){
		try {
			if(rs!=null){
				rs.close();
			}
			rs = null;
		} catch (Exception e) {
		}
		try {
			if(pstmt!=null){
				pstmt.close();
			}
			pstmt = null;
		} catch (Exception e) {
		}
		try {
			if(conn!=null){
				conn.close();
			}
			conn = null;
		} catch (Exception e) {
		}
	}
}
